﻿using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Windows;
using Microsoft.Practices.Composite.Events;
using Microsoft.Practices.Composite.Presentation.Events;

namespace WizardSample
{
    /// <summary>
    /// 
    /// </summary>
    static class Programme
    {
        public static IEventAggregator EventAggregator = new EventAggregator();

        /// <summary>
        /// 
        /// </summary>
        private static void OnCommand(KeyValuePair<String,Object> command)
        {
            switch (command.Key)
            {
            }
        }

        /// <summary>
        /// 
        /// </summary>
        [STAThread]
        static void Main()
        {
            Programme.EventAggregator
                .GetEvent<CommandNotificationEvent>()
                .Subscribe(OnCommand);

            // -----------------------------------------------------------------------------------
            AuthenticationWizardData wizardData =
                new AuthenticationWizardData()
                {
                    IISSiteList = new List<IISSiteData>()
                                          {
                                              new IISSiteData()
                                                  {
                                                      IISSiteId = 1,
                                                      IISSite = @"Default Web Site"
                                                  },
                                              new IISSiteData()
                                                  {
                                                      IISSiteId = 2,
                                                      IISSite = @"Internal Web Site"
                                                  }
                                          },
                    IISSiteItem = 0,    // 1 Based. i.e Default Web Site
                    AuthServiceVirtualPath = @"/Citrix/AuthServices",
                    FarmName = @"Farm1",
                    FarmPort = 8080,
                    FarmSSLRelayPort = 443,
                    FarmTransport = @"SSL Relay",
                    FarmServers = new ObservableCollection<String>()
                    /*
                                          {
                                              @"CAMWGOTCHAL01",
                                              @"camwdevappweb",
                                              @"defaultfailover"
                                          }
                                          */
                    ,AuthenticationServiceMode = true
                };

            WizardDialog wizard = new WizardDialog(wizardData);
            // WizardDialog wizard = new WizardDialog();
            // wizard.WizardData = wizardData;

            wizard.AddPage(new WizardPageAuthSitePath());
            wizard.AddPage(new WizardPageAuthService());
            wizard.AddPage(new WizardPageAuthFarm());
            wizard.AddPage(new WizardPageAuthSummary());
            wizard.Start();
            // wizard.WizardReturn += wizardReturn;
            
            Boolean? dialogResult = wizard.ShowDialog();

            if (dialogResult.Value)
            {
                // MessageBox.Show("Finished.");
            }
            else
            {
                // MessageBox.Show("Canceled.");
            }
        }

    }
}
